<script type="text/html" id="modalLoadingContent">
    <div class="modal-dialog modal-lg">
        <div class="modal-content animated fadeIn">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">加载中</h4>
            </div>
            <div class="modal-body">
                <p class="text-info">正在加载中,请稍后...</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</script>
<script src="/static/inspinia/js/popper.min.js"></script>
<script src="/static/inspinia/js/bootstrap.js"></script>
<script src="/static/inspinia/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/inspinia/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="/static/inspinia/js/inspinia.js"></script>
<script src="/static/inspinia/js/plugins/pace/pace.min.js"></script>
<!-- jQuery UI -->
<script src="/static/inspinia/js/plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Toastr -->
<script src="/static/inspinia/js/plugins/toastr/toastr.min.js"></script>
<script src="/static/inspinia/js/common.js"></script>
<script crossorigin="anonymous" src="//lib.baomitu.com/layer/3.1.1/layer.js"></script>
<script>
    function ifrSubmitResponseHandle(res){
        $('#commonModal').find('.modal-footer').children('button').removeAttr('disabled');
        if(res.success){
            $('#commonModal').modal('hide');
            toastr.success(res.msg,'提示:');
            return;
        }
        toastr.error(res.msg,'提示:');
    }
    $(function(){
        if(globalValues.intoMsg){
            setTimeout(function(){
                toastr.options = {
                    closeButton: true,
                    progressBar: true,
                    showMethod: 'slideDown',
                    timeOut: 4000
                };
                toastr.success(globalValues.intoMsg,'提示:');
            },1300);
        }
        $(document).ajaxComplete(function(event,xhr,settings){
            let response = xhr.responseText;
            if(response){
                let resJson = JSON.parse(response);
                if(resJson._check_err){
                    layer.closeAll();
                    $('.modal').modal('hide');
                    toastr.error(resJson.msg,'提示:');
                }
            }
        });
        $('#commonModal').html($('#modalLoadingContent').html()).on('hidden.bs.modal',function(e){
            $(this).html($('#modalLoadingContent').html()).find('.modal-footer').children('button').removeAttr('disabled');
        }).on('click','.btn-save',function(){
            $(this).attr('disabled',true).siblings('button').attr('disabled',true);
            $(this).parent().prev().children('form').submit();
        });
        jQuery.fn.extend({
            fileInputBeautiful:function(){
                let _fileUploadBtnEl = '<div class="upload_box"><div class="process"></div><span>0</span></div><button type="button" class="btn btn-block btn-info" style="width:60px;height:60px;"><i class="fa fa-upload"></i><br>上传</button>';
                $(this).css({position:'absolute',top:0,zIndex:9,opacity:0,height:'60px',width:'60px',cursor:'pointer'}).parent().css('position','relative').prepend(_fileUploadBtnEl);
                return this;
            }
        });
    });
</script>
